Skip to content

feat(config): move from hydra to pydantic models - #1221

Draft
project-defiant wants to merge 9 commits into
opentargets:devfrom
project-defiant:dev-origin
Draft

feat(config): move from hydra to pydantic models#1221
project-defiant wants to merge 9 commits into
opentargets:devfrom
project-defiant:dev-origin

Conversation

@project-defiant

Copy link
Copy Markdown
Contributor

✨ Context

🛠 What does this PR implement

🙈 Missing

🚦 Before submitting

  • Do these changes cover one single feature (one change at a time)?
  • Did you read the contributor guideline?
  • Did you make sure to update the documentation with your changes?
  • Did you make sure there is no commented out code in this PR?
  • Did you follow conventional commits standards in PR title and commit messages?
  • Did you make sure the branch is up-to-date with the dev branch?
  • Did you write any new necessary tests?
  • Did you make sure the changes pass local tests (make test)?
  • Did you make sure the changes pass pre-commit rules (e.g uv run pre-commit run --all-files)?

SzymonSzyszkowski and others added 9 commits April 24, 2026 10:34
- Create config/ package with SessionDefaults (Pydantic frozen model)
- Move all legacy step config dataclasses to config/defaults.py
- Rewrite test_config.py for Pydantic SessionDefaults model
- All 15 existing step config dataclasses remain importable from gentropy.config

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add BiosampleIndexDefaults Pydantic model (all fields required)
- Update BiosampleIndexStep constructor to accept (config, session)
- Rewrite test to construct config and validate step initialization
- Add config validation test

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add ColocalisationDefaults Pydantic model with 3 required + 3 optional fields
- Update ColocalisationStep constructor to accept (config, session)
- Add config validation tests and update existing tests to use config

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Migrate the following steps from dataclass StepConfig to Pydantic
config models: credible_set_qc, decode_ingestion (4 configs),
intervals (2 configs), study_locus_validation, study_validation,
sumstat_qc_step, variant_index (2 configs).

Fix duplicate class definition bugs caused by sequential Write tool
operations in 4 files: sumstat_qc_step, study_validation,
variant_index, intervals.

Update all corresponding test files to use (config=Defaults(...),
session=...) pattern and add config validation tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add co-located Pydantic config models and update step classes to
accept (config, session) parameters for:

- eqtl_catalogue, finngen_finemapping_ingestion, finngen_studies,
  finngen_sumstat_preprocess, finngen_ukb_mvp_meta, foldx_ingestion
- gnomad_ingestion
- gwas_catalog_study_curation, gwas_catalog_study_index,
  gwas_catalog_sumstat_preprocess, gwas_catalog_top_hits
- l2g (4 configs: evidence, associations, feature_matrix, model)
- ld_based_clumping, locus_breaker_clumping
- lof_curation_ingestion, molecular_complex, pics, pqtl_study
- ukb_ppp_eur_sumstat_preprocess, window_based_clumping

All files pass ruff check, ruff format, and mypy. 8 test failures
are pre-existing (unrelated to these changes).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ation_method

- Replace mutable list[] defaults with Field(default_factory=list) in:
  - study_validation.py (StudyValidationDefaults.invalid_qc_reasons)
  - study_locus_validation.py (StudyLocusValidationDefaults.invalid_qc_reasons)
  - intervals.py (IntervalE2GDefaults.invalid_qc_reasons)
  - intervals.py (IntervalEpiractionDefaults.invalid_qc_reasons)
- Add field_validator for colocalisation_method in colocalisation.py
  to reject invalid values at config validation time (case-insensitive)
- Simplify step body normalization code since fields are now always list[str]

Agent-Logs-Url: https://github.com/project-defiant/gentropy/sessions/25062353-a56a-4286-a077-a67a6c204c94

Co-authored-by: project-defiant <69353402+project-defiant@users.noreply.github.com>
@project-defiant project-defiant changed the title Dev origin feat(config): move from hydra to pydantic models May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants